import {Injectable} from '@angular/core';
import {HttpService} from '../http.service';
import {adSystemApiUrl} from '../../../../config/api';

@Injectable()

export class CouponsService {

    constructor(
        private httpService: HttpService
    ) {}

    /**
     * 权限列表
     * @param name
     * @param model
     * @param orderField
     * @param orderSort
     * @param pageSize
     * @returns {Observable<R>}
     */
    getCouponsTagList(page, pageSize) {
        const url = `${ adSystemApiUrl }/v2/admin/card_coupons_tag/platform_card_coupons_tag_list_get?page_size=${ pageSize }&page=${ page }`;
        return this.httpService.httpPostAuth(url, {}).map(data => data);
    }

    addCouponsTag(data) {
        const url = `${ adSystemApiUrl }/v2/admin/card_coupons_tag/platform_card_coupons_tag_add_post`;
        return this.httpService.httpPostAuth(url, data).map(data => data);
    }

    editCouponsTag(data) {
        const url = `${ adSystemApiUrl }/v2/admin/card_coupons_tag/platform_card_coupons_tag_edit_post`;
        return this.httpService.httpPostAuth(url, data).map(data => data);
    }
}